package com.msh.artascope.devcloud.client.enums.biz;

import com.msh.frame.client.define.StringDef;
import com.msh.frame.interfaces.ICodeDescEnum;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@AllArgsConstructor
public enum HealthTestProbeModeEnum implements ICodeDescEnum {
  /**
   *
   */
  HTTP("http","http请求"),
  TCP("tcp","tcp连接"),
  EXEC("exec","执行命令"),
  ;

  private final String code;
  private final String desc;

  public static String codeDesc(String code){
    for(HealthTestProbeModeEnum e: values()){
      if(e.getCode().equals(code)){
        return e.getDesc();
      }
    }
    return StringDef.EMPTY;
  }

  /**
   * http检测
   */
  @Data
  @NoArgsConstructor
  @AllArgsConstructor
  public static class HttpTest implements Serializable {
    private Integer port;
    private String path;
  }


  /**
   * tcp检测
   */
  @Data
  @NoArgsConstructor
  @AllArgsConstructor
  public static class TcpTest implements Serializable{
    private Integer port;

  }


  /**
   * exec 检测
   */
  @Data
  @NoArgsConstructor
  @AllArgsConstructor
  public static class ExecTest implements Serializable{
    private String command;
  }
}